/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AnalizadorMain.java
 *
 * Created on 06-dic-2011, 0:10:32
 */
package es.plg.trad.analizador.main;

import es.plg.trad.analizador.AnalizadorLex;
import es.plg.trad.analizador.Sobre;
import es.plg.trad.utils.PintaFondo;
import java.awt.Component;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JTextArea;


/**
 *
 * @author hp
 */
public class AnalizadorMain extends javax.swing.JFrame {
    private static final long serialVersionUID = 1L;

    /** Creates new form AnalizadorMain */
    public AnalizadorMain() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        plasticLookAndFeel1 = new com.jgoodies.looks.plastic.PlasticLookAndFeel();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        openMenuItem = new javax.swing.JMenuItem();
        saveMenuItem = new javax.swing.JMenuItem();
        saveAsMenuItem = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        contentMenuItem = new javax.swing.JMenuItem();
        aboutMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Traductor Pascal --> C++");
        setIconImage(new javax.swing.ImageIcon(getClass().getResource("/es/plg/trad/resources/images/pasc_c.png")).getImage());

        jDesktopPane1.setBackground(new java.awt.Color(240, 240, 240));
        jDesktopPane1.setName("jDesktopPane1"); // NOI18N
        jDesktopPane1.setOpaque(false);

        ImageIcon img = new ImageIcon(new javax.swing.ImageIcon(getClass().getResource("/es/plg/trad/resources/images/Fondo_pantalla.jpg")).getImage());

        fileMenu.setMnemonic('f');
        fileMenu.setText("Archivo");
        fileMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fileMenuActionPerformed(evt);
            }
        });

        openMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        openMenuItem.setMnemonic('o');
        openMenuItem.setText("Análisis Léxico");
        openMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                openMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(openMenuItem);

        saveMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.CTRL_MASK));
        saveMenuItem.setMnemonic('s');
        saveMenuItem.setText("Análisis Sintáctico");
        saveMenuItem.setEnabled(false);
        fileMenu.add(saveMenuItem);

        saveAsMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        saveAsMenuItem.setMnemonic('a');
        saveAsMenuItem.setText("Análisis Semántico");
        saveAsMenuItem.setEnabled(false);
        fileMenu.add(saveAsMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setMnemonic('h');
        helpMenu.setText("Ayuda");

        contentMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        contentMenuItem.setMnemonic('c');
        contentMenuItem.setText("Manual de usuario");
        contentMenuItem.setEnabled(false);
        helpMenu.add(contentMenuItem);

        aboutMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        aboutMenuItem.setMnemonic('a');
        aboutMenuItem.setText("Sobre");
        aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutMenuItemActionPerformed(evt);
            }
        });
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1109, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 589, Short.MAX_VALUE)
                .addContainerGap())
        );

        try{
            jDesktopPane1.setBorder(new PintaFondo());
        } catch(MalformedURLException e){

        } catch(IOException e){

        }

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileMenuActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_fileMenuActionPerformed

private void openMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMenuItemActionPerformed
// TODO add your handling code here:
   AnalizadorLex analex =  new AnalizadorLex();
   this.jDesktopPane1.add(analex);
   analex.setVisible(true);
}//GEN-LAST:event_openMenuItemActionPerformed

private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
// TODO add your handling code here:
    Sobre s  = new Sobre(this,true);
    this.jDesktopPane1.add(s);
    s.setLocation(350, 250);
    s.setVisible(true);
}//GEN-LAST:event_aboutMenuItemActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(AnalizadorMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(AnalizadorMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(AnalizadorMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(AnalizadorMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                 AnalizadorMain anm = new AnalizadorMain();
                 anm.setVisible(true);
                 //new AnalizadorLex().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JMenuItem contentMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem openMenuItem;
    private com.jgoodies.looks.plastic.PlasticLookAndFeel plasticLookAndFeel1;
    private javax.swing.JMenuItem saveAsMenuItem;
    private javax.swing.JMenuItem saveMenuItem;
    // End of variables declaration//GEN-END:variables

    

    /**
     * 
     */
    public void Exit_on_close() {
    }
        /*
     * Obtener las acctiones del jTextArea para ejecutarlas.
     */
    /**
     * 
     * @param jtxt
     */
    public void ejectutaAciones(JTextArea jtxt){
//        ActionMap acciones  = jtxt.getActionMap();
//        /*
//         * Declaraciones de las acciones.
//         */
//        
//        javax.swing.Action actCopy = acciones.get(DefaultEditorKit.copyAction);
//        javax.swing.Action actPaste = acciones.get(DefaultEditorKit.pasteAction);
//        javax.swing.Action ctEdit = acciones.get(DefaultEditorKit.writableAction);
//        javax.swing.Action actCut = acciones.get(DefaultEditorKit.cutAction);
//        //final Action Action = null;
//        
//        /**
//         * Manejo de las Aciones.
//         */
//        actCopy.putValue(javax.swing.Action.NAME, "Copiar");
//        actCopy.putValue(
//                javax.swing.Action.ACCELERATOR_KEY,
//                KeyStroke.getAWTKeyStroke('C', Event.CTRL_MASK));
//
//        actCut.putValue(javax.swing.Action.NAME, "Cortar");
//        actCut.putValue(
//                javax.swing.Action.ACCELERATOR_KEY,
//                KeyStroke.getAWTKeyStroke('X', Event.CTRL_MASK));
//
//        actPaste.putValue(javax.swing.Action.NAME, "Pegar");
//        actPaste.putValue(
//                javax.swing.Action.ACCELERATOR_KEY,
//                 KeyStroke.getAWTKeyStroke('V', Event.CTRL_MASK));
//        
//        
    }

}